home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1993, 1996, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
- /* background.c - open a window and clear the background.
- * glutMainLoop() calls drawScene whenever the window needs
- * to be updated.
- */
- #include <GL/gl.h>
- #include <GL/glut.h>
-
- /* Function Prototypes */
- GLvoid initgfx( GLvoid );
- GLvoid drawScene( GLvoid );
-
- void checkError( char * );
-
- void
- main( int argc, char *argv[] )
- {
- GLsizei width, height;
-
- glutInit( &argc, argv );
-
- /* create a window that is 1/4 the size of the screen,
- * and position it in the middle of the screen.
- */
- width = glutGet( GLUT_SCREEN_WIDTH );
- height = glutGet( GLUT_SCREEN_HEIGHT );
- glutInitWindowPosition( width / 4, height / 4 );
- glutInitWindowSize( width / 2, height / 2 );
- glutInitDisplayMode( GLUT_RGBA );
- glutCreateWindow( argv[0] );
-
- initgfx();
-
- glutDisplayFunc( drawScene );
- glutMainLoop();
- }
-
- GLvoid
- initgfx( GLvoid )
- {
- /* set clear color to magenta */
- glClearColor( 1.0, 0.0, 1.0, 1.0 );
- }
-
- void
- checkError( char *label )
- {
- GLenum error;
- while ( (error = glGetError()) != GL_NO_ERROR )
- printf( "%s: %s\n", label, gluErrorString(error) );
- }
-
-
- GLvoid
- drawScene( GLvoid )
- {
- glClear( GL_COLOR_BUFFER_BIT );
-
- /* Do all your OpenGL rendering here */
-
- checkError( "drawScene" );
- glFlush();
- }
-